#include <cstdio>

class parent {
public:
    void printclass() {
        printf("pc ");
    }
    virtual void printvirtual() {
        printf("pv ");
    };
};
class child : public parent {
public:
    void printclass() {
        printf("cc ");
    };
    virtual void printvirtual() {
        printf("cv ");
    };
};

void print(parent& p) {
    p.printclass();
    p.printvirtual();
}

main() {
    parent p;
    child c;
    parent *q;

    print(p);
    print(c);

    q = &p;
    print(*q);
// printclass parent due to overload; printvirtual child
    q = &c;
    print(*q);

    printf("\n");
}
